$(function() {
    var d0 = [[0,0],[1,0],[2,1],[3,2],[4,15],[5,5],[6,12],[7,10],[8,55],[9,13],[10,25],[11,10],[12,12]];
    var options= {
        series: {
            splines: {
                show: true,
                tension: 0.4,
                lineWidth: 1,
                fill: 0.4
            },
            points: {
                radius: 0,
                show: true
            },
            shadowSize: 2
        },
        grid: {
            hoverable: true,
            tickColor: "#d9dee9",
            borderWidth: 1,
            color: '#d9dee9'
        },
        colors: ["#19b39b", "#644688"],
        xaxis:{ticks:12},
        yaxis: {ticks: 4},
        tooltip: true,
        tooltipOpts: {content: "u位占用数为%y.4",
            defaultTheme:true,
            shifts: {x:0, y:20}
        }
    };
    $("#flot-sp1ine-1").length && $.plot($("#flot-sp1ine-1"), [d0],options);
    $("#flot-sp1ine-2").length && $.plot($("#flot-sp1ine-2"), [d0],options);
    $("#flot-sp1ine-3").length && $.plot($("#flot-sp1ine-3"), [d0],options);
    $("#flot-sp1ine-4").length && $.plot($("#flot-sp1ine-4"), [d0],options);
    $("#flot-sp1ine-5").length && $.plot($("#flot-sp1ine-5"), [d0],options);
    // pie
    var da = [
            {
                label: "iPhone5S",
                data: 40
            },
            {
                label: "iPad Mini",
                data: 10
            },
            {
                label: "iPad Mini Retina",
                data: 20
            },
            {
                label: "iPhone4S",
                data: 12
            },
            {
                label: "iPad Air",
                data: 18
            }
        ],
        da1 = [],
        series = Math.floor(Math.random() * 4) + 3;
    for (var i = 0; i < series; i++) {
        da1[i] = {
            label: "Series" + (i + 1),
            data: Math.floor(Math.random() * 100) + 1
        }
    }
    $("#flot-pie-donut").length && $.plot($("#flot-pie-donut"), da, {
        series: {
            pie: {
                innerRadius: 0.4,
                show: true,
                stroke: {
                    width: 0
                },
                label: {
                    show: true,
                    threshold: 0.05
                },

            }
        },
        colors: ["#65b5c2","#4da7c1","#3993bb","#2e7bad","#23649e"],
        grid: {
            hoverable: true,
            clickable: false
        },
        tooltip: true,
        tooltipOpts: {
            content: "%s: %p.0%"
        }
    });
})